package Java练习.面向对象综合练习.基础;

public class GoodsText {
    public static void main(String[] args) {


        //定义一个数组存储商品
        Goods[] arr = new Goods[3];
        //创建3个商品对象
        Goods g1 = new Goods(1001, "手机", 1999, 100);
        Goods g2 = new Goods(1002, "手提包", 2000, 90);
        Goods g3 = new Goods(1003, "鞋子", 300, 500);
        //添加商品到数组
        arr[0]=g1;
        arr[1]=g2;
        arr[2]=g3;
        //遍历数组
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i].getGoodsName()+','+arr[i].getPrize()+","+arr[i].getStock());
        }
    }
}
